<template>
    <el-dialog
            v-model="$store.state.modalFlag"
            :title="$store.state.modalData.title"
            width="30%"
            :before-close="handleClose"
    >
        <span>{{$store.state.modalData.msg}}</span>

        <template #footer>
      <span class="dialog-footer">
        <el-button type="primary"
                   @click="handleClose"
        >确认</el-button
        >
      </span>
        </template>
    </el-dialog>
</template>

<script>
    export default {
        name: "modal-popup",
        methods: {
            handleClose(){
                this.$store.commit("modalFlag",false)
                console.log(this.$store.state.modalData)
            }
        },
        // setup() {
        //     const handleClose = ()=>{
        //         console.log($store.state.modalFlag)
        //     };
        //     return {
        //         handleClose,
        //     }
        // }
    }
</script>

<style scoped>

</style>